<template>
	<page-body>
		<view class="page">
			<view
				class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex feedBack_flex_0_higd"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-stretch justify-between feedBack_fd0_0_higd'>
					<view class='flex flex-wrap align-center feedBack_fd0_0_c0_higd' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  feedBack_fd0_0_c0_c0_higd'>&#xe794;</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<text class='feedBack_fd0_0_c1_c0_higd'>{{$t('意见反馈')}}</text>
					</view>
					<view class='flex align-center justify-end feedBack_fd0_0_c2_higd' @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/xtsz/feedBackDetail/feedBackDetail`">
						<!-- #ifndef MP-WEIXIN -->
						<text class='feedBack_fd0_0_c2_c0_higd'>{{$t('反馈记录')}}</text>
							<!-- #endif -->
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---意见反馈表单flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout feedBack_flex_1_higd">
				<view class='flex flex-direction align-stretch feedBack_fd1_0_higd'>
					<view class='flex flex-wrap align-center feedBack_fd1_0_c0_higd'>
						<text class='feedBack_fd1_0_c0_c0_higd'>{{$t('反馈类型')}}</text>
						<!-- #ifdef MP-WEIXIN -->
						<text   @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/xtsz/feedBackDetail/feedBackDetail`" style="margin: 0 32rpx 0 auto;color: rgba(211, 42, 41, 1);" class='feedBack_fd0_0_c2_c0_higd'>反馈记录</text>
						<!-- #endif -->
					</view>
					<view class='flex flex-direction flex-wrap align-stretch feedBack_fd1_0_c1_higd'>
						<benben-select-diy ref="showSelectPopup1689675271268" class-name='flex-wrap align-center flex'
							:items.sync="dataList" v-model="changeId" default-type="aid" default-label="name"
							:allow-cancel='false' type="radio" :disabled='false'>
							<benben-select-item v-for='(item,key0) in dataList' :hand-value='item.aid' :key='key0'>
								<template #selected>
									<view class='flex align-center justify-center flex feedBack_fd1_0_c1_c0_c0_higd'>
										<text class='flex-sub feedBack_fd1_0_c1_c0_c0_c0_higd'>{{item.title}}</text>
									</view>
								</template><template #no-selected>
									<view class='flex align-center justify-center flex feedBack_fd1_0_c1_c0_c1_higd'>
										<text class='flex-sub feedBack_fd1_0_c1_c0_c1_c0_higd'>{{item.title}}</text>
									</view>
								</template>
							</benben-select-item>
						</benben-select-diy>
					</view>
					<text class='feedBack_fd1_0_c2_higd'>{{$t('问题描述')}}</text>
					<view class='flex flex-direction flex-wrap align-stretch feedBack_fd1_0_c3_higd'>
						<view class='flex flex-wrap feedBack_fd1_0_c3_c0_higd'>
							<benben-textarea class='flex feedBack_input_fd1_0_c3_c0_higd' confirm-type="done"
								:placeholder="$t('问题描述的越详细，有助于我们更快的解决问题')" :maxlength="300" :show-num='true'
								placeholder-style="color:#999;font-size:28rpx" v-model="body" />
							<template>
								<view class='flex flex justify-end feedBack_numberfd1_0_c3_c0_c0_higd'>
									<text>{{body.length}}</text>
									<text>/</text>
									<text>300</text>
								</view>
							</template>
						</view>
					</view>
					<view class='flex flex-direction flex-wrap align-stretch'>
						<benben-images-upload ref="benbenImagesUploadfd1_0_c4_c0" :img-list.sync="img"
							:img-ids.sync="img_id" :is-show-tips='true' :maxlength="6">
							<template #content="{ num, maxlength, isShow}">
								<view class="flex flex-wrap align-start flex feedBack_fd1_0_c4_c0_higd">

									<view v-for="(image, index) in img" :key="index"
										class='flex position-relative feedBack_fd1_0_c4_c00_higd'>
										<benben-clean-icon
											class='fu-iconfont2 position-absolute feedBack_fd1_0_c4_c000_higd'
											hand-name="benben-images-upload" hand-method="delImage" :hand-index="index">
											&#xE8E7;</benben-clean-icon>
										<benben-image-item class='feedBack_fd1_0_c4_c001_higd' mode="aspectFill"
											hand-name="benben-images-upload" hand-method="previewImage"
											:hand-index="index" :src='image'></benben-image-item>
									</view>


									<benben-image-item class='feedBack_fd1_0_c4_c01_higd' mode="aspectFit"
										hand-name="benben-images-upload" hand-method="manyChooseImage" v-if="isShow"
										:src='STATIC_URL+"77.png"'></benben-image-item>
									<text
										class='image_upload_tips feedBack_fd1_0_c4_c02_higd'>{{$t('请上传应用截图，最多上传')}}{{maxlength}}{{$t('张')}}</text>
								</view>
							</template>
						</benben-images-upload>
					</view>
				</view>
				<button class='flex-sub feedBack_fd1_1_higd' @tap.stop="postfeedbackFunc()">{{$t('提交反馈')}}</button>
			</view>

			<!---意见反馈表单flex布局结束-->


		</view>
	</page-body>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"changeId": "1",
				"changeType": [{
					"name": "下载/加载问题",
					"value": "1",
					"image": ""
				}, {
					"name": "会员付费问题",
					"value": "2",
					"image": ""
				}, {
					"name": "章节/图片问题",
					"value": "3",
					"image": ""
				}, {
					"name": "APP体验问题",
					"value": "4",
					"image": ""
				}, {
					"name": "卡顿/不流畅",
					"value": "5",
					"image": ""
				}, {
					"name": "其他",
					"value": "6",
					"image": ""
				}],
				"dataList": [],
				"body": "",
				"img": [],
				"img_id": "",
				isfk:false,
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			this.getTypeFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//提交反馈
			async postfeedbackFunc() {
				if(this.isfk){
					return
				}
				if (!validate(this.changeId, 'require')) {
					this.$message.info(global.i18n.t('请选择反馈类型'));
					return false;
				}
				if (!validate(this.body, 'require')) {
					this.$message.info(global.i18n.t('请输入问题描述'));
					return false;
				}
				//请求方法
				//数据验证
				this.isfk=true
				let data6414724b96f3f = await this.$api.dbPost(global.apiUrls.post6414724b96f3f, {
					type_id: this.changeId,
					body: this.body,
					thumb: this.img_id
				});
				if (!data6414724b96f3f) return
					
				if (data6414724b96f3f.data.code != 1) {
					this.isfk=fasle
					this.$message.info(data6414724b96f3f.data.msg);
					return
				}
				let info6414724b96f3f = data6414724b96f3f.data;
				this.$message.info('反馈成功');
				setTimeout(function() {
					uni.navigateBack()
				}, 800);
				// this.$urouter.redirectTo(`/pages/tabBar/my/my`);
			},
			//获取反馈类型
			async getTypeFunc() {
				//请求方法
				//数据验证

				let datadataList = await this.$api.post(global.apiUrls.post6414719bdc956, {
					user_type: '1'
				});

				if (datadataList.data.code != 1) {
					this.$message.info(datadataList.data.msg);
					return
				}
				let infodataList = datadataList.data;
				this.dataList = infodataList.data

				this.changeId = this.dataList[0].aid //默认类型id
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(246, 247, 249, 1);
		background-size: 100% auto;

		.feedBack_flex_1_higd {
			background: rgba(255, 255, 255, 1);
			background-size: 100% auto;

			.feedBack_fd1_0_higd {
				background: rgba(255, 255, 255, 1);
				background-size: 100% auto !important;
				padding: 0rpx 0rpx 48rpx 0rpx;
				margin: 0rpx 0rpx 180rpx 0rpx;

				.feedBack_fd1_0_c0_higd {
					padding: 32rpx 0rpx 12rpx 0rpx;

					.feedBack_fd1_0_c0_c0_higd {
						font-size: 32rpx;
						font-weight: 500;
						color: var(--benbenFontColor0);
						margin: 0rpx 32rpx 0rpx 32rpx;
					}
				}

				.feedBack_fd1_0_c1_higd {
					padding: 0rpx 16rpx 16rpx 16rpx;
					border-bottom: 10px solid rgba(246, 247, 248, 1);

					.feedBack_fd1_0_c1_c0_c0_higd {
						margin: 16rpx 16rpx 16rpx 16rpx;
						height: 64rpx;
						border-radius: 8rpx 8rpx 8rpx 8rpx;
						background: rgba(211, 42, 41, 1);
						width: 206rpx;
						padding: 0rpx 10rpx 0rpx 10rpx;

						.feedBack_fd1_0_c1_c0_c0_c0_higd {
							font-size: 28rpx;
							font-weight: 400;
							color: var(--benbenFontColor3);
							line-height: 62rpx;
							-webkit-line-clamp: 1;
							overflow: hidden;
							text-overflow: ellipsis;
							display: -webkit-box;
							-webkit-box-orient: vertical;
							text-align: center;
						}
					}

					.feedBack_fd1_0_c1_c0_c1_higd {
						margin: 16rpx 16rpx 16rpx 16rpx;
						height: 64rpx;
						border-radius: 8rpx 8rpx 8rpx 8rpx;
						width: 206rpx;
						padding: 0rpx 10rpx 0rpx 10rpx;
						border: 1px solid #eee;

						.feedBack_fd1_0_c1_c0_c1_c0_higd {
							font-size: 28rpx;
							font-weight: 400;
							color: var(--benbenFontColor0);
							line-height: 62rpx;
							-webkit-line-clamp: 1;
							overflow: hidden;
							text-overflow: ellipsis;
							display: -webkit-box;
							-webkit-box-orient: vertical;
							text-align: center;
						}
					}
				}

				.feedBack_fd1_0_c2_higd {
					font-size: 32rpx;
					font-weight: 500;
					color: var(--benbenFontColor0);
					line-height: 109rpx;
					margin: 0rpx 32rpx 0rpx 32rpx;
				}

				.feedBack_fd1_0_c3_higd {
					margin: 0rpx 0rpx 32rpx 0rpx;

					.feedBack_fd1_0_c3_c0_higd {
						width: 686rpx;
						border-radius: 10rpx 10rpx 10rpx 10rpx;
						margin: 0rpx 0rpx 0rpx 32rpx;
						padding: 32rpx 24rpx 32rpx 24rpx;
						background: rgba(247, 247, 247, 1);
						background-size: 100% auto;

						.feedBack_input_fd1_0_c3_c0_higd {
							width: 100%;
							height: 166rpx;
							font-size: 28rpx;
							font-weight: 400;
							color: var(--benbenFontColor0);
						}

						.feedBack_numberfd1_0_c3_c0_c0_higd {
							width: 100%;
							font-size: 24rpx;
							color: rgba(153, 153, 153, 1);
							line-height: 46rpx;
							font-weight: 400;
						}
					}
				}

				.feedBack_fd1_0_c4_c0_higd {
					padding: 24rpx 0rpx 0rpx 24rpx;

					.feedBack_fd1_0_c4_c00_higd {
						margin: 0rpx 24rpx 24rpx 0rpx;

						.feedBack_fd1_0_c4_c000_higd {
							top: 0rpx;
							right: 0rpx;
							z-index: 10;
							color: #ff5536;
						}

						.feedBack_fd1_0_c4_c001_higd {
							width: 160rpx;
							height: 160rpx;
							border-radius: 16rpx 16rpx 16rpx 16rpx;
						}
					}

					.feedBack_fd1_0_c4_c01_higd {
						width: 160rpx;
						height: 160rpx;
						margin: 0rpx 24rpx 24rpx 0rpx;
						border-radius: 16rpx 16rpx 16rpx 16rpx;
					}

					.feedBack_fd1_0_c4_c02_higd {
						font-size: 24rpx;
						color: var(--benbenFontColor2);
						font-weight: 400;
						width: 100%;
					}
				}
			}

			.feedBack_fd1_1_higd {
				border-radius: 44rpx 44rpx 44rpx 44rpx;
				font-size: 32rpx;
				background: rgba(211, 42, 41, 1);
				color: var(--benbenFontColor3);
				height: 88rpx;
				line-height: 88rpx;
				width: 638rpx;
				position: fixed;
				left: 53rpx;
				bottom: calc(40rpx + var(--window-bottom));
			}
		}

		.feedBack_flex_0_higd {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			z-index: 10;
			top: 0rpx;
			background: #fff;
			background-size: 100% auto !important;
			border-bottom: 1px solid #eee;

			.feedBack_fd0_0_higd {
				padding: 0rpx 32rpx 0rpx 32rpx;
				line-height: 88rpx;

				.feedBack_fd0_0_c0_higd {
					width: 200rpx;

					.feedBack_fd0_0_c0_c0_higd {
						font-size: 36rpx;
						font-weight: 400;
						color: #333;
					}
				}

				.feedBack_fd0_0_c1_c0_higd {
					font-size: 36rpx;
					font-weight: 500;
					color: var(--benbenFontColor0);
					line-height: 50rpx;
				}

				.feedBack_fd0_0_c2_higd {
					padding: 0rpx 0rpx 0rpx 0rpx;
					width: 200rpx;

					.feedBack_fd0_0_c2_c0_higd {
						font-size: 28rpx;
						font-weight: 500;
						color: rgba(211, 42, 41, 1);
					}
				}
			}
		}
	}
</style>
